package com.controller;

import com.entitys.User;
import com.serivice.BookService;
import com.serivice.UserService;
import com.utils.JsonData;
import com.vo.R;
import com.vo.req.LoginDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

   private final UserService userService;


   /**
    * 获得验证码
    * @return
    */
   @GetMapping("/captchaCode")
   public R<Map> getCaptchaCode(){
      return userService.getCaptchaCode();
   }

   /**
    * 用户登录
    * @param loginDTO
    * @return
    */
   @PostMapping("/login")
   public R<Map> login(@RequestBody LoginDTO loginDTO){
      return userService.login(loginDTO);
   }
}
